import { createApp } from "vue"
import { createPinia } from "pinia"
//pinia数据持久化
import { usePersist } from "pinia-use-persist"
//引入elementUI
import ElementPlus from "element-plus"
//引入elementUI的样式
import "element-plus/dist/index.css"
//引入element的字体图标
import * as ElementPlusIconsVue from "@element-plus/icons-vue"
//引入vant组件
import {
  DropdownMenu,
  DropdownItem,
  Cell,
  Popup,
  Form,
  Field,
  CellGroup,
  Overlay,
  Picker,
  Button,
  NoticeBar,
  List,
  Search,
  NavBar
} from "vant"
//引入vant组件样式
import "vant/lib/index.css"
import App from "./App.vue"
import router from "./router"
import "./assets/main.css"

const app = createApp(App)
const pinia = createPinia()
pinia.use(usePersist)
app.use(pinia)
app.use(router)
//注册elementUI插件
app.use(ElementPlus)
//注册element中的所有字体图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
//注册vant组件
app.use(DropdownMenu)
app.use(DropdownItem)
app.use(Cell)
app.use(Popup)
app.use(Form)
app.use(Field)
app.use(CellGroup)
app.use(Overlay)
app.use(Picker)
app.use(Button)
app.use(NoticeBar)
app.use(List)
app.use(Search)
app.use(NavBar)

app.mount("#app")
